﻿using System.Collections.Generic;
using GeneticAlgorithms.Genomes;

namespace GeneticAlgorithms.Operators.Mating
{
    /// <summary>
    /// Base interface for all mating operators.
    /// </summary>
    /// <typeparam name="TGenome">The type of the genome.</typeparam>
    /// <typeparam name="TGene">The type of the gene.</typeparam>
    public interface IGeneticMater<TGenome, TGene>
        where TGenome : IGenome<TGene>
    {
        /// <summary>
        /// Gets the cardinality of the mating operation.
        /// </summary>
        /// <value>The cardinality of the mating operation: 
        /// that is, how many genomes a mating will put
        /// together at each step.</value>
        int Cardinality { get; }

        /// <summary>
        /// Mates the specified genomes.
        /// </summary>
        /// <param name="genomes">The genomes to be agrouped in pairs.</param>
        /// <returns>
        /// A genome of aggrouped genomes. Each group represents a mating set.
        /// </returns>
        IEnumerable<TGenome[]> Mate(IEnumerable<TGenome> genomes);
    }
}
